/*
 * story:
 *  服务接收请求，返回响应
 *
 *
 * TODO list:
 * 1. input "X03=A100" -> returnn "X03=A101"
 * 2. input "X03=A200" -> returnn "X03=A201"
 */

#include "gtest.h"
#include <string>

using namespace std;

class Acsvr {
public:
    string requestHandle(const string & req) {
        //return "X03=A101";
        string rsp = req;
        rsp[req.size() -1] = '1';
        return rsp; 
    }
};

TEST(AcsvrTest, testA100) {
    string exceptRsp = "X03=A101";
    string req = "X03=A100";
    
    Acsvr acsvr;
    ASSERT_EQ(exceptRsp, acsvr.requestHandle(req));
}

TEST(AcsvrTest, testA200) {
    string exceptRsp = "X03=A201";
    string req = "X03=A200";
    
    Acsvr acsvr;
    ASSERT_EQ(exceptRsp, acsvr.requestHandle(req));
}

void __testReqHandle(const string & expect, const string & req) {
    Acsvr acsvr;
    ASSERT_EQ(expect, acsvr.requestHandle(req));
}

TEST(AcsvrTest, testReq) {
    __testReqHandle("X03=A101", "X03=A100");
    __testReqHandle("X03=A201", "X03=A200");
}
